﻿using System;
using System.Web;
using System.Web.SessionState;
using Token.Piker.Core.Security;
using Token.Util;

namespace Token.Piker.Web.AJAX
{
    /// <summary>
    /// Logout 的摘要说明
    /// </summary>
    public class Logout : BaseAjaxHandler
    {

        class Log_Out
        {
            //操作是否成功
            public string success;
        }

        protected override void Mapping()
        {
            OprationMap["Logout"] = "LogoutPikerUser";
        }

        protected override void ResponseTemplate(Object data)
        {
            ResponseText = JsonHelper.Serialize(data);
        }

        public void LogoutPikerUser()
        {
            try
            {
                Log_Out logout = new Log_Out();

                HttpSessionState Session = HttpContext.Current.Session;
                Session.Abandon();

                logout.success = "true";

                ResponseTemplate(logout);
                IsSuccess = true;
            }
            catch
            {
                IsSuccess = false;
            }
        }
    }
}